<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" id="html">
    <head>
        <title></title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <base href="<?= base_url(1); ?>" />
        <link type="text/css" href="css/main.css?v=<?= $config['version'] ?>" rel="stylesheet" />
        <script type="text/javascript">
        
        function selecttype()
        {
            if (document.getElementById("logtype").selectedIndex == 0) {
                document.getElementById("group_name_tr").style.display = "table-row";
            } else {
                document.getElementById("group_name_tr").style.display = "none";
            }

        }

		function selectclass()
		{
			if(document.getElementById("logclass").selectedIndex == 0){
				document.getElementById("area_list").style.display = "none";
				document.getElementById("log_type").style.display = "none";
				document.getElementById("group_name_tr").style.display = "none";
			}else{
				document.getElementById("area_list").style.display = "table-row";
				document.getElementById("log_type").style.display = "table-row";
				document.getElementById("group_name_tr").style.display = "table-row";
			}
		}
        </script>
    </head>
    <body>
        <?php include(VIEWPATH . 'common/main_header.php'); ?> 
        <form action="" method="POST" id="rowForm">
            <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tablegrid tableedit">
             	<tr align="left">
                    <th colspan="2" align="left"><?= $title ?></th>
                </tr>  
                <tr>
                <td><?= translate('DOWNLOAD_LOG_LOGCLASS') ?>:</td>
                <td><select name="row[logclass]" id="logclass" onchange="selectclass()">
               <?php foreach ($logclass as $key => $value) { ?>
               <option value="<?=$key ?>">
                 <?=$value ?>
               </option>
               <?php }?>
             </select></td>
                </tr>
                <tr id="area_list" style="display: none"><td><?= translate('SELECT_AREA') ?>:</td><td><?= $arealist ?></td></tr>
                <tr><td><?= translate('STARTTIME') ?>:</td><td><input type='text' name='row[starttime]' id='starttime' class='datepicker' value="<?= $startTime ?>"/></td></tr>
                <tr><td><?= translate('ENDTIME') ?>:</td><td><input type="text" name="row[endtime]" id="endtime" class='datepicker'  value="<?= $endTime ?>"/></td></tr>  
                <tr id="log_type" style="display: none"><td><?= translate('DOWNLOAD_LOG_LOGTYPE')?>:</td>
                <td><select name="row[logtype]" id="logtype" onchange="selecttype()">
               <?php foreach ($logtype as $key => $value) { ?>
               <option value="<?=$key ?>">
                 <?=$value ?>
               </option>
               <?php }?>
             </select></td>
                </tr>   
                <tr id="group_name_tr" style="display:none">
                <td><?= translate('DOWNLOAD_LOG_SINGLELOG')?>:</td>
                <td>
                <dl>
                <?php foreach ($permission as $k => $v) { ?>
                <?php if (false !== strpos($k, "log_")) { ?>
                <?php 	foreach ($v['item'] as $k1 => $v1) { ?>
                			<?php if ($k1 != 'accountcreate') { ?>
                			<input type="checkbox" name="row[permission][]" value="<?= $v1['name'] ?>" id="c-<?= $k1?>" /><label for="c-<?= $k1?>"><?= $v1['name']?></label>
                			<?php } ?>
                <?php 	} ?>
                <?php } ?>	
                <?php } ?>
                </dl>
                </td>
                </tr>
                <tr><td></td><td><input type="submit" value="<?= translate('SUBMIT') ?>" id="submit"/> <input type="reset" value="<?= translate('RESET') ?>" id="reset"/></td></tr>
            </table>
        </form>
        <!-- 
        <form>
        		<table width="100%" border="1" cellspacing="1" cellpadding="0" class="tablegrid tableedit"> 
        		<tr><td>日志名称</td><td>操作</td></tr>
                	<?php foreach ($ziplist as $k=>$v) {?>
                	<tr><td><?= $v?></td><td><intput type="button" value="下载" /></td></tr>
                	<?php } ?>
                </table>
        </form>
        -->
        <div class="datalist"><table id="flexigrid" style="display:none"></table></div>
        <script type="text/javascript">
            $(function() {
                $("#flexigrid").flexigrid($.extend(SG.flexOptions, {
                    url: '<?= site_url('download_log/downloadlogdata/flexigrid') ?>',
                    colModel: [
                        {display: '<?= translate('ID') ?>', name: 'id', width: 80, iskey: true},                       
                        {display: '<?= translate('DOWNLOAD_LOG_LOGNAME') ?>', name: 'filename', width: 800},
                        {display: '<?= translate('DOWNLOAD_LOG_CREATETIME') ?>', name: 'createtime', width: 200},
                        {display: '<?= translate('MANAGE') ?>', name: 'id', width: 135, sortable: false, process: formatOp}
                    ],
                    buttons: [
                       //{name: 'export', displayname: "<?= translate('EXPORT') ?>", bclass: 'export', onpress: multi},
                        // {name: 'add', displayname: "<?= translate('ADD') ?>", title: "<?= translate('ADD') ?>", bclass: 'add', onpress: multi},
                    ],
                    searchitems: false,
                }));
                SG.admin = $.extend(SG.admin, {
                	//add_url: '<?= site_url("download_log/downloadlogdata/add") ?>',
                    edit_url: '<?= site_url("download_log/downloadlogdata/edit/") ?>',
                });
            });
        </script>    
        <script type="text/javascript">
            SG.init("core.form", function() {
                $.formValidator.initConfig({formid: "#rowForm", submitonce: true});
                //$("#logclass").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
                //$("#area_host").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
                //$("#rolename").formValidator({empty: false, onshow: '<?= translate('PLASE_INPUT_ROLE_NAME') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});  
                $("#starttime").formValidator({empty: false, onshow: '<?= translate('PLASE_WRITE') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
                $("#endtime").formValidator({empty: false, onshow: '<?= translate('PLASE_WRITE') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});                        
            });
        </script>
    </body>
</html>
